// components/add-todo/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    list: {// 收集清单
      type: Array,
      value: []
    }
  },
  data: {
    listId: "",
    date: "",
    value: "",
    alarm: false,// TODO 自行课下完成
    order: 0,// TODO 自行课下完成
    showList: false
  },
  attached() {
  },
  methods: {
    close() {
      this.setData({
        show: false
      })
    },
    getValue(e) {
      this.setData({
        value: e.detail.value
      })
    },
    bindDateChange: function (e) {
      console.log('picker发送选择改变，携带值为', e.detail.value)
      this.setData({
        date: e.detail.value
      })
    },
    catchShowList() {
      this.setData({
        showList: !this.data.showList
      })
    },
    selectList(e) {
      this.setData({
        listId: e.currentTarget.dataset._id,
        showList: false
      })
    },
    sure() {
      let {listId,date,value,alarm,order} = this.data;
      this.triggerEvent("change",{
        listId,date,value,alarm,order
      },{})
    }
  }
})
